<template>
	<view class="box">
		<view>
			<up-text type="primary" text="主色"></up-text>
		</view>
		<view>
			<up-button type="primary" text="打印版本" @click="showVersion"></up-button>
		</view>
		<view>
			<up-button type="error" shape="circle" icon="map" text="发送请求" @click="sendTryMessage"></up-button>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from 'vue';
	import {
		tryConnectUser
	} from '@/common/api.js';

	const show = ref(true);
	const showVersion = () => {
		uni.showModal({
			title: '提示',
			content: `${uni.$u.config.v}`,
			showCancel: false,
			confirmText: '确定',
		});
	}
	const sendTryMessage = () => {
		tryConnectUser().then((res)=>{
			uni.showToast({
				title: '请求成功',
				icon: 'success'
			})
			console.log(res);
		}).catch((err)=>{
			uni.showToast({
				title: '请求失败',
				icon: 'error'
			})
			console.log(err);
		})
	}
</script>
<style scoped lang="scss">
	.box {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
	}

	.box view {
		margin: 10px;
	}
</style>